<style>
page {
  background: white;
}
</style>
<style lang="scss" scoped>
.content {
  width: 100%;
  padding-top: 15vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.img {
  width: 464rpx;
  height: 326rpx;
}
.ipt {
  width: 690rpx;
  height: 100rpx;
  background: #f5f6f7;
  border-radius: 50rpx;
  margin-top: 50rpx;
  padding: 0 30rpx;
  input {
    flex: 1;
  }
  .scan {
    width: 100rpx;
    height: 40rpx;
    border-left: 1px solid #dee2ee;
  }
}
.btn {
  width: 690rpx;
  height: 88rpx;
  background: #409eff;
  border-radius: 44rpx;
  margin-top: 50rpx;
}
</style>

<template>
  <view class="content colum-flex">
    <image class="img" src="../../static/images/property.png" mode=""></image>
    <view class="ipt between-flex">
      <input type="text" v-model="code" placeholder="请输入设备编号" />
      <view class="scan center-flex" @click="scan">
        <u-icon name="scan" color="#409eff"></u-icon>
      </view>
    </view>
    <view class="btn center-flex cfff f32" @click="submit">巡检</view>
  </view>
</template>

<script>
import PagesPollingRouterConfig from "@/pagesPolling/routerConfig.js";
export default {
  data() {
    return {
      head: this.$head,
      code: "",
    };
  },
  onShow() {},
  methods: {
    scan() {
      uni.scanCode({
        success: (e) => {
          console.log(e);
          if (e.result) {
            this.code = e.result;
            this.submit();
          }
        },
      });
    },
    submit() {
      this.$pop
        .ajaxPost("/bus/inspection/work/scan", {
          qrcode: this.code,
        })
        .then((res) => {
          if (res.body) {
            this.$navTo(
              PagesPollingRouterConfig.PollingDetail + "?executeId=" + res.body
            );
          }
        });
    },
  },
};
</script>
